<extend name="Layout/ins_popup" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<div class="popup-frame">
		<div class="popup-header">
			<div class="pull-left">
				<h1>添加成员</h1>
			</div>
			<div class="pull-right">
				<div class="layui-input-inline col-12">
					<form name="form_search" id="form_search" method="post" >
						<input class="layui-input" type="text" name="keyword" id="keyword">
						<a class="add-on" id="submit_search"><i class="fa fa-search"></i></a>
					</form>
				</div>
				<a id="btn_save" class="btn" >确定</a>
				<a id="btn_close" class="btn btn-cancel">关闭</a>
			</div>
		</div>
		<div class="popup-body">
			<div class="popup-body-scroll">
				<div class="popup-content">
					<form id="form_data" name="form_data" method="post" >
						<input type="hidden" name="opmode" id="opmode" value="add">
						<input type="hidden" name="group_id" id="group_id" value="{$group_id}">
						<table class="table table-bordered">
							<thead>
								<tr>
									<th class="col-2 x-checkbox">
									<input type="checkbox"class="toggle-select-all"  class="toggle-select-all" data="user_id[]"/>
									</th>
									<th>
									<nobr>
										员工编号
									</nobr></th>
									<th>
									<nobr>
										姓名
									</nobr></th>
									<th>
									<nobr>
										部门
									</nobr></th>
									<th class="hidden">
									<nobr>
										职级
									</nobr></th>
									<th>
									<nobr>
										职位
									</nobr></th>
									<th>
									<nobr>
										状态
									</nobr></th>
								</tr>
							</thead>
							<tbody class="tbody">
								<volist name="user_list" id="data">
									<tr id="{$data.id}">
										<td class="col-2 x-checkbox">
										<input  type="checkbox" name="user_id[]" value="{$data.id}" />
										</td>
										<td>
										<nobr>
											{$data.emp_no}
										</nobr></td>
										<td>
										<nobr>
											{$data.name}
										</nobr></td>
										<td>
										<nobr>
											{$data.dept_name}
										</nobr></td>
										<td class="hidden">
										<nobr>
											{$data.rank_name}
										</nobr></td>
										<td>
										<nobr>
											{$data.position_name}
										</nobr></td>
										<td>
										<nobr>
											{$data.is_del|status}
										</nobr></td>
									</tr>
								</volist>
							</tbody>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		layui.use(['global'], function() {
			var $ = layui.jquery;

			var layer = layui.layer;

			//保存后关闭
			$('#btn_save').on('click', function() {
				if ($("input:checked[name='user_id[]']").length < 1) {
					layer.msg("请选择用户");
					return false;
				};
				send_form('form_data', '{:U("save_user")}', '', function(ret) {
					if (ret.status == 1) {
						parent.layer.msg(ret.info);
						parent.layer.close(index);
						parent.location.reload(true);
					} else {
						parent.layer.msg(ret.info);
						return false;
					}
				});
			});

			//关闭iframe
			$('#btn_close').click(function() {
				parent.layer.close(index);
			});
		});

	</script>
</block>